import torch
# a = torch.randn(3,2,4)
# shape = a.shape
# shape_tensor = torch.tensor(shape, dtype=torch.long)
# print(shape_tensor)
from gxl_ai_utils.utils import utils_file



def filter_aishell_test():
    """"""
    input_scp = "/home/work_nfs15/asr_data/data/asr_test_sets/aishell/wav.scp"
    err_dict = {}
    res_wav_dict = {}
    wav_dict = utils_file.load_dict_from_scp(input_scp)
    for key, wav in utils_file.tqdm(wav_dict.items(), total=len(wav_dict)):
        if utils_file.get_file_size(wav)*1024 < 1:
            err_dict[key] = wav
        else:
            res_wav_dict[key] = wav

    utils_file.print_dict(err_dict)
    for key, wav in err_dict.items():
        """"""
        source_wav = wav.replace("work_nfs15", "work_nfs8")
        utils_file.copy_file(source_wav, wav)
    # utils_file.write_dict_to_scp(res_wav_dict, input_scp)

if __name__ == '__main__':
    filter_aishell_test()